//microcommand define -lnnbot-clean-module-cache
signature("<spec:rawtext>", { authority: 4, strictOptions: true })
action(({ session }, spec) => {
try {
return (delete require.cache[require.resolve(spec)]) ? session.text(".cleared") : session.text(".not-cached")
} catch {
return session.text(".module-not-found")
}
})
locale("zh-CN", { description: "清除指定模块的加载缓存", messages: { cleared: "已清除。", "not-cached": "该模块目前没有加载缓存。", "module-not-found": "未找到指定模块。" } })